home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Keyboard.h
-
- Contains: interfaces for keyboard componets
-
- Version: Technology:
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- */
- #ifndef __KEYBOARD__
- #define __KEYBOARD__
-
- #ifndef __CONDITIONALMACROS__
- #include <ConditionalMacros.h>
- #endif
- #ifndef __EVENTS__
- #include <Events.h>
- #endif
- #ifndef __IOITERATOR__
- #include <IOIterator.h>
- #endif
- #ifndef __TIMING__
- #include <Timing.h>
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import on
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=mac68k
- #endif
-
- #if FOR_SYSTEM8_PREEMPTIVE
- /* Virtual ID for a keyboard */
- typedef UInt32 KeyboardID;
- /* System 8.x version of of a Keymap */
- typedef Byte KeyboardMap[32];
- /* System 8.x version of a virtual key */
- typedef UInt8 VirtualKeyCode;
- /* System 8.x definition of keyboard modifiers */
- typedef UInt16 KeyboardModifiers;
- /* System 8.x definition of keyboard direction */
-
- enum {
- kKeyDirectionKeyDown = 0x0001,
- kKeyDirectionKeyUp = 0x0002,
- kKeyDirectionAutoKeyDown = 0x0003
- };
-
- typedef short KeyDirection;
- typedef UInt32 KeyboardDeviceMode;
- /* Keyboard Event returned from I/O subsystem */
- struct LowLevelKeyEvent {
- KeyboardID theBoard;
- VirtualKeyCode theKey;
- SInt8 filler1;
- KeyDirection direction;
- KeyboardModifiers modifiers;
- AbsoluteTime theEventTime;
- };
- typedef struct LowLevelKeyEvent LowLevelKeyEvent;
-
-
- enum {
- kKeyboardHardwareTypeUnknown = 0,
- kKeyboardHardwareTypeADB = 1,
- kKeyboardHardwareTypeSerial = 2
- };
-
- typedef UInt32 KeyboardHardwareType;
- struct KeyboardIOIteratorData {
- IOCommonInfo IOCommon;
- KeyboardHardwareType theType;
- UInt32 keycount;
- UInt32 kcapResID;
- Boolean hasNumericKeypad;
- Boolean hasLEDFeedback;
- };
- typedef struct KeyboardIOIteratorData KeyboardIOIteratorData;
-
- typedef KeyboardIOIteratorData KeyboardDeviceRecord;
-
- enum {
- kKeyboardLEDOff = false,
- kKeyboardLEDOn = true
- };
-
- typedef Boolean KeyboardLEDState;
-
- enum {
- kKeyboardLEDNumLock = 0,
- kKeyboardLEDCapsLock = 1,
- kKeyboardLEDScrollLock = 2
- };
-
- typedef short KeyboardLEDSelector;
- extern OSStatus GetKeyMap(KeyboardID theID, KeyboardMap theMap);
-
- extern OSStatus KeyboardIsKeyDown(VirtualKeyCode theKey, KeyDirection *keyState, KeyboardModifiers *modifierState);
-
- /* Warning: This routine is intended only for clients who need to bypass the events system altogether. */
- extern OSStatus GetNextLowLevelKeyEvent(LowLevelKeyEvent *theKey);
-
- extern OSStatus GetLastKeypressTime(AbsoluteTime *theTime);
-
- extern OSStatus GetKeyboardLEDStatus(KeyboardID theID, short theLight, Boolean *value);
-
- extern OSStatus SetKeyboardLEDStatus(KeyboardID theID, short theLight, Boolean value);
-
- extern OSStatus GetKeyboardDeviceMode(KeyboardID theID, KeyboardDeviceMode *theMode);
-
- extern OSStatus SetKeyboardDeviceMode(KeyboardID theID, KeyboardDeviceMode theMode);
-
- /* Device Iteration */
- extern OSStatus GetKeyboardDeviceRecord(KeyboardID theID, KeyboardDeviceRecord *theDeviceRecord);
-
- extern OSStatus KeyboardGetDeviceData(ItemCount requestItemCount, ItemCount *totalItemCount, KeyboardIOIteratorData *iteratorBuffer);
-
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=reset
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import off
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __KEYBOARD__ */
-
-